


import java.util.Timer;
import javax.swing.JProgressBar;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * -
 * @author Jose Luis Orta
 */
public abstract class AccionProgreso implements Runnable {
        private Timer tim;
        private Thread th;
        private JProgressBar jpb;
        private Progreso p;
        private Runnable accionFin;
        private int milis;
        public AccionProgreso(JProgressBar jpb, Progreso p, Runnable accionFin){
            this.jpb=jpb;
            this.p=p;
            this.accionFin=accionFin;
            milis=50;
            th = new Thread(this);
            tim = new Timer();
        }
        public void ejecutarYMonitorizar(){
            p.setX(0);
            tim.scheduleAtFixedRate(new StepAccionProgreso(tim,p,jpb, accionFin), 0,milis);
            th.start();
        }
        public void setMilis(int milisegundos){
            milis=milisegundos;
        }
}
